﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace _2017
{
    public partial class preview : System.Web.UI.Page
    {
            /// <summary>
        /// 取得网站根目录的物理路径 index.aspx?op=
        /// </summary>
        /// <returns></returns>
        public static string GetRootPath()
        {
            string AppPath = "";
            HttpContext HttpCurrent = HttpContext.Current;
            if (HttpCurrent != null)
            {
                AppPath = HttpCurrent.Server.MapPath("~");
            }
            else
            {
                AppPath = AppDomain.CurrentDomain.BaseDirectory;
                if (Regex.Match(AppPath, @"\\$", RegexOptions.Compiled).Success)
                    AppPath = AppPath.Substring(0, AppPath.Length - 1);
            }
            return AppPath;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["op"] == "getAs")//当前模板所有页面
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/getAs.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "mgetAs")//当前模板所有页面
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/mgetAs.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "weixinShare")//
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/weixinShare.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetStatCNum")//
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/GetStatCNum.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetSceneCopyright")//
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/GetSceneCopyright.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GetSceneDomain")//
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/GetSceneDomain.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
            else if (Request.QueryString["op"] == "GoodsRefer")//
            {
                string basePath = GetRootPath();
                string json = File.ReadAllText(basePath + "json_wx/GoodsRefer.json");
                Response.ContentType = "application/json";
                Response.Write(json);
                Response.End();
            }
        
        }

    }
}